<?php 
get_header();
?>

<div id="content" class="narrowcolumn">
<h2><?php echo get_option('wpsary_pagetitle') ;?></h2>

<?php

if ($albums) {
		?>
<div id="album">
	<table>
		<tr>
<?php 
foreach ($albums as $album) {
$i++;
$album->metadata = maybe_unserialize($album->metadata);
$dir = wpsary_getUploadDir();
	?>
		<td width="130" align="center">
			<?php if ($album->metadata['thumb']) { ?>
			<img src="<?php echo $dir['url'] . $album->metadata['thumb'] ;?>" width="<?php echo $album->metadata['hwstring_small'] ;?>" border="0"/>
			<?php } ?>
	<?php if ($album->title) {?>
	<div id="photocaption">
		<?php echo  "<a href=\""  . get_bloginfo('siteurl') . "/" . $_SERVER['REQUEST_URI'] . "/" . $album->id . "\"> " .stripslashes($album->title) . "</a>"; ?>
	</div>
			<?php
			}
			if ($i % get_option('wpsary_colnumbers') == 0 ) {
				echo "</tr><tr>";
			}
		}
	?>
		</tr>
	</table>
</div>
		<?php
} else {
	_e('No album found', 'wpsary');
}

?>

</div>

<?php
get_sidebar();
get_footer();
?>